import Vue from 'vue'
import Vuex from 'vuex'
import {getinformain} from "../api/api";

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    isMoreShow:false,
    userInfo:{},
    isLogin:true,
    isReplyShow:false
  },
  mutations: {
    changeIsMoreShow(state,payload){
      state.isMoreShow = payload.isMoreShow;
    },
    changeLogin(state,payload){
      state.isLogin=payload.isLogin;
    },
    changeUserInfo(state,payload){
      state.userInfo=payload.userInfo;
    },
    changeIsReplyShow(state,payload){
      state.isReplyShow = payload.isReplyShow
    }
  },
  actions: {
    asyncChangeLogin(context){
      getinformain().then(res=>{
        console.log(res)
        if(res.data.code==0){
          context.commit("changeUserInfo",{userInfo:res.data.data})
          context.commit("changeLogin",{isLogin:false})
        }
      })
    }
  },
  modules: {
  }
})
